Importing rows of a table in Word as requirements

Hello DOORS user,

(I am using DOORS 8.3)
I have a Word document with a lot of tables and each table has 4 columns, the last column of which I would like to import as a Requirement.

Does any one know how to do this ?
best regards

Colm
(PS: not sure if I should post this to the DXL forum. Perhaps there is a way of doing with with some DXL commands but I am also open to hearing if there are any VBA macros you can apply to Word and then import to DOORS)
MyDeveloerWorks - Wed May 25 08:59:45 EDT 2011

Re: Importing rows of a table in Word as requirements
rmoskwa - Wed May 25 17:26:51 EDT 2011

Is your intent to extract column 4 from all of the tables in the doc, and to import all of "these" at once into DOORS?

OR

Are your tables separated by headings, and you want to strip away columns 1, 2, and 3 from all of the tables, and import what is left (headings and column4s) in the doc into DOORS?

Both of these can be done with Word macros.

Re: Importing rows of a table in Word as requirements
MyDeveloerWorks - Thu May 26 04:06:00 EDT 2011

rmoskwa - Wed May 25 17:26:51 EDT 2011
Is your intent to extract column 4 from all of the tables in the doc, and to import all of "these" at once into DOORS?

OR

Are your tables separated by headings, and you want to strip away columns 1, 2, and 3 from all of the tables, and import what is left (headings and column4s) in the doc into DOORS?

Both of these can be done with Word macros.

Hello,

The first option is preferable,but I would like to be able at later stage to extend the macro so that I could import column entries 1-3 as attributes of the requirement.

The arrangement in the document can be roughly described as follows:

Table 1 (1...M)
___________________
col1 col2 col3 col4

A1 | A2| A3 | R
.
.
(each table with its own number of rows (N))

where R = Requiremement
A1..3 = Attribute 1..3
"M" Tables in total

Re: Importing rows of a table in Word as requirements
Peter_Albert - Thu May 26 04:28:18 EDT 2011

MyDeveloerWorks - Thu May 26 04:06:00 EDT 2011
Hello,

The first option is preferable,but I would like to be able at later stage to extend the macro so that I could import column entries 1-3 as attributes of the requirement.

The arrangement in the document can be roughly described as follows:

Table 1 (1...M)
___________________
col1 col2 col3 col4


A1 | A2| A3 | R
.
.
(each table with its own number of rows (N))

where R = Requiremement
A1..3 = Attribute 1..3
"M" Tables in total

An easy solution for the later stage would be a script in the kitchen library, which converts tables into objects with attributes. The attribute names are taken from the first row, so if the column titles are always the same, you could find/replace in Word first the title of column 4 with "Object Text", and the titles of column 1 to 3 with the respective attribute names.

Mathis has put the kitchen library on http://rapidshare.com/files/405757700/kitchen_tools.zip.html.

Regards,

Peter

Re: Importing rows of a table in Word as requirements
SystemAdmin - Thu May 26 04:30:29 EDT 2011

MyDeveloerWorks - Thu May 26 04:06:00 EDT 2011
Hello,

The first option is preferable,but I would like to be able at later stage to extend the macro so that I could import column entries 1-3 as attributes of the requirement.

The arrangement in the document can be roughly described as follows:

Table 1 (1...M)
___________________
col1 col2 col3 col4


A1 | A2| A3 | R
.
.
(each table with its own number of rows (N))

where R = Requiremement
A1..3 = Attribute 1..3
"M" Tables in total

These things are often better 'fixed' in Word. In this case I would suggest that you create a word macro to convert the table to text and format so that you have some xml-like encoding. If each table row resolves to a single Word paragraph then you can run a relatively simple dxl script to separate out the four attribute values (Object Text, A1, A2 and A3)

The alternative is a much more complex dxl script to work through the table, create new objects and then delete the table again.

In either case you will need some expertise - if you have Word macro wizards available then use that route, and find a beginner dxl programmer or better (searching through sub-strings is the hardest thing here), otherwise you will need a relatively experienced dxl programmer to sort through the tables and create new objects.

Re: Importing rows of a table in Word as requirements
rmoskwa - Thu May 26 11:28:56 EDT 2011

MyDeveloerWorks - Thu May 26 04:06:00 EDT 2011
Hello,

The first option is preferable,but I would like to be able at later stage to extend the macro so that I could import column entries 1-3 as attributes of the requirement.

The arrangement in the document can be roughly described as follows:

Table 1 (1...M)
___________________
col1 col2 col3 col4


A1 | A2| A3 | R
.
.
(each table with its own number of rows (N))

where R = Requiremement
A1..3 = Attribute 1..3
"M" Tables in total

I believe this code will help you achieve a portion of the first option.
You need to copy it into Normal.dot or where ever you want to store your Word macros.
Read the comments at the beginning on how to use it.
I did not spend any time making it interactive with the user.
After you run it, save the Destination doc to be safe.
Then you can export it from Word to DOORS.

Good Luck...


Sub tableColumn4MoveToAnotherDoc() 
' 
' tableColumn4MoveToAnotherDoc Word Macro 
' 
'This macro has severe limitations! 
'Use this macro as follows: 
' Copy the file to be processed to it's own folder. 
' Rename the copy to Source.doc 
' Create a file named Destination.doc in the same folder. 
' Open both files in Word. 
' Run this macro in the Source doc. 
' 
' Dim oTable As Table   Windows(
"Source.doc").Activate For Each oTable In ActiveDocument.Tables oTable.Columns(4).Select 
'This code replaces paragraph marks inside a table cell 
'with manual line breaks.  This keeps these sentences together 
'in the same DOORS object when exported from Word to DOORS. Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = 
"^p" .Replacement.Text = 
"^l" .Forward = True .Wrap = wdFindStop End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Copy Windows(
"Destination.doc").Activate Selection.Paste Windows(
"Source.doc").Activate Next   
'MsgBox "All Tables Moved..."   Windows(
"Destination.doc").Activate For Each oTable In ActiveDocument.Tables oTable.Select Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, _ NestedTables:=True Next   
'MsgBox "Process complete." End Sub

Re: Importing rows of a table in Word as requirements
PDU - Fri May 27 02:26:53 EDT 2011

MyDeveloerWorks - Thu May 26 04:06:00 EDT 2011
Hello,

The first option is preferable,but I would like to be able at later stage to extend the macro so that I could import column entries 1-3 as attributes of the requirement.

The arrangement in the document can be roughly described as follows:

Table 1 (1...M)
___________________
col1 col2 col3 col4


A1 | A2| A3 | R
.
.
(each table with its own number of rows (N))

where R = Requiremement
A1..3 = Attribute 1..3
"M" Tables in total

Hi,

i send you two DXL scripts.
First you need import Word document in Doors keeping tables as tables.
The scripts transform a Table in an Object with attribut.
They are written for tables with only one requirement by table, so you need perhaps to modify script or to modify tables.

  • first (ExtraitExigenceTablePosition.dxl) : this script made the assumption that tables have four cells in witch we have :
. the ident of the requirement
. description
. reference of requirements from other document (traceability)
. conformity.
  • second (ExtraitExigenceTableStyle_V2.dxl) : this script made the assumption that tables have from one to ten cells, and that each cell have a specific Word Style.

regards
Pierre
Attachments

attachment_14621794_ExtraitExigenceTable.zip

Re: Importing rows of a table in Word as requirements
MyDeveloerWorks - Tue May 31 03:48:58 EDT 2011

rmoskwa - Thu May 26 11:28:56 EDT 2011
I believe this code will help you achieve a portion of the first option.
You need to copy it into Normal.dot or where ever you want to store your Word macros.
Read the comments at the beginning on how to use it.
I did not spend any time making it interactive with the user.
After you run it, save the Destination doc to be safe.
Then you can export it from Word to DOORS.

Good Luck...


Sub tableColumn4MoveToAnotherDoc() 
' 
' tableColumn4MoveToAnotherDoc Word Macro 
' 
'This macro has severe limitations! 
'Use this macro as follows: 
' Copy the file to be processed to it's own folder. 
' Rename the copy to Source.doc 
' Create a file named Destination.doc in the same folder. 
' Open both files in Word. 
' Run this macro in the Source doc. 
' 
' Dim oTable As Table   Windows(
"Source.doc").Activate For Each oTable In ActiveDocument.Tables oTable.Columns(4).Select 
'This code replaces paragraph marks inside a table cell 
'with manual line breaks.  This keeps these sentences together 
'in the same DOORS object when exported from Word to DOORS. Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = 
"^p" .Replacement.Text = 
"^l" .Forward = True .Wrap = wdFindStop End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Copy Windows(
"Destination.doc").Activate Selection.Paste Windows(
"Source.doc").Activate Next   
'MsgBox "All Tables Moved..."   Windows(
"Destination.doc").Activate For Each oTable In ActiveDocument.Tables oTable.Select Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, _ NestedTables:=True Next   
'MsgBox "Process complete." End Sub

Thanks for the VBA macro. That allows me get my data quickly into DOORS. Regarding the other suggestions, I will try them as soon as I have edit DXL access granted.

Re: Importing rows of a table in Word as requirements
llandale - Tue May 31 17:26:27 EDT 2011

Just browsed the other replies. Perhaps delete the first 3 columns of each table, select the remaining (formerly 4th) column, and convert table to text. Go from there.